home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / T U R B O Language / Turbo C v2.0 / INCLUDE / MATH.H < prev    next >
Text File  |  1988-08-29  |  3KB  |  107 lines

  1. /*    math.h
  2.  
  3.     Definitions for the math floating point package.
  4.  
  5.     Copyright (c) Borland International 1987,1988
  6.     All Rights Reserved.
  7. */
  8. #if __STDC__
  9. #define _Cdecl
  10. #else
  11. #define _Cdecl    cdecl
  12. #endif
  13.  
  14. #ifndef  _MATH_H
  15. #define  _MATH_H 1
  16.  
  17. #define EDOM    33        /* Math argument */
  18. #define ERANGE    34        /* Result too large */
  19.  
  20. #define HUGE_VAL    _huge_dble
  21. extern double _Cdecl _huge_dble;
  22.  
  23. int    _Cdecl abs   (int x);
  24. double    _Cdecl acos  (double x);
  25. double    _Cdecl asin  (double x);
  26. double    _Cdecl atan  (double x);
  27. double    _Cdecl atan2 (double y, double x);
  28. double    _Cdecl atof  (const char *s);
  29. double    _Cdecl ceil  (double x);
  30. double    _Cdecl cos   (double x);
  31. double    _Cdecl cosh  (double x);
  32. double    _Cdecl exp   (double x);
  33. double    _Cdecl fabs  (double x);
  34. double    _Cdecl floor (double x);
  35. double    _Cdecl fmod  (double x, double y);
  36. double    _Cdecl frexp (double x, int *exponent);
  37. long    _Cdecl labs  (long x);
  38. double    _Cdecl ldexp (double x, int exponent);
  39. double    _Cdecl log   (double x);
  40. double    _Cdecl log10 (double x);
  41. double    _Cdecl modf  (double x, double *ipart);
  42. double    _Cdecl pow   (double x, double y);
  43. double    _Cdecl sin   (double x);
  44. double    _Cdecl sinh  (double x);
  45. double    _Cdecl sqrt  (double x);
  46. double    _Cdecl tan   (double x);
  47. double    _Cdecl tanh  (double x);
  48.  
  49. struct    exception 
  50. {
  51.     int    type;
  52.     char   *name;
  53.     double    arg1, arg2, retval;
  54. };
  55.  
  56. int _Cdecl matherr (struct exception *e);
  57.  
  58. #if !__STDC__
  59. double    cdecl hypot (double x, double y);
  60. double    cdecl poly  (double x, int degree, double coeffs []);
  61. double    cdecl pow10 (int p);
  62.  
  63. struct complex        /* as used by "cabs" function */
  64. {
  65.     double  x, y;
  66. };
  67.  
  68. #define cabs(z)     (hypot ((z).x, (z).y))
  69.  
  70. /*  The customary matherr() exception handler for maths functions is
  71.     not compatible with the x3j11 draft standard for C.  _matherr() is
  72.     provided as a compromise.
  73. */
  74.  
  75. typedef enum
  76. {
  77.     DOMAIN = 1,    /* argument domain error -- log (-1)        */
  78.     SING,       /* argument singularity  -- pow (0,-2))     */
  79.     OVERFLOW,       /* overflow range error  -- exp (1000)      */
  80.     UNDERFLOW,       /* underflow range error -- exp (-1000)     */
  81.     TLOSS,       /* total loss of significance -- sin(10e70) */
  82.     PLOSS,       /* partial loss of signif. -- not used      */
  83. }   _mexcep;
  84.  
  85. double _Cdecl _matherr (_mexcep why, char *fun, double  *arg1p,
  86.             double  *arg2p, double  retval);
  87.  
  88. /* Constants rounded for 21 decimals. */
  89. #define M_E        2.71828182845904523536
  90. #define M_LOG2E        1.44269504088896340736
  91. #define M_LOG10E    0.434294481903251827651
  92. #define M_LN2        0.693147180559945309417
  93. #define M_LN10        2.30258509299404568402
  94. #define M_PI        3.14159265358979323846
  95. #define M_PI_2        1.57079632679489661923
  96. #define M_PI_4        0.785398163397448309116
  97. #define M_1_PI        0.318309886183790671538
  98. #define M_2_PI        0.636619772367581343076
  99. #define M_1_SQRTPI    0.564189583547756286948
  100. #define M_2_SQRTPI    1.12837916709551257390
  101. #define M_SQRT2        1.41421356237309504880
  102. #define M_SQRT_2    0.707106781186547524401
  103.  
  104. #endif    /* __STDC__ */
  105.  
  106. #endif
  107.